<?php
/**
 */
header("Content-Type:text/html;charset=uft-8;");
require "URPCurl.php";
require dirname(__FILE__)."/phpQuery/phpQuery.php";

$request = new URPCurl(
    "http://202.118.65.18/loginAction.do",
    [
        "zjh" => "201392043",
        "mm" => "216910",
    ],
    "http://202.118.65.18/gradeLnAllAction.do?type=ln&oper=fainfo&fajhh=4520");

$response = $request->exec();
$response = mb_convert_encoding($response, "utf-8","gbk");

$dom = phpQuery::newDocument($response);

$scopes = [];
$first = 0;

foreach(pq('#user tr') as $items)
{
    if ($first == 1)
    {
        $items = pq($items)->text();
        $items = explode("\n", $items);
        foreach($items as $key => $value)
        {
            $items[$key] = trim($value);
            if (mb_strlen($items[$key]) == 0
                || $key == 10 || $key == 24)
            {
                unset($items[$key]);
            }

        }
        $scopes [] = $items;
    }
    $first = 1;
}


var_dump($scopes);
echo json_encode($scopes);

?>